package com.tjtt.tdm.knowledge.dao.impl;

import java.util.List;
import java.util.Map;

import com.tjtt.tdm.base.HibernateEntityDAO;
import com.tjtt.tdm.exception.DaoException;
import com.tjtt.tdm.knowledge.bean.KnowFileType;
import com.tjtt.tdm.knowledge.bean.KnowledgeType;
import com.tjtt.tdm.knowledge.dao.IKnowledgeDao;

/**
 * 
 * @author songxiaoyan
 *
 */
public class KnowledgeDaoImpl extends HibernateEntityDAO<KnowledgeType> implements IKnowledgeDao{

	public List<KnowledgeType> getAllTypes(Map filterMap) throws DaoException {
		
		String hql = "from KnowledgeType  entity where 1=1 ";
		if(filterMap!=null)
		{
			if(filterMap.get("knowledgeTypeId")!=null)  hql += " and entity.knowledgeTypeId = " + filterMap.get("knowledgeTypeId");
		}
		hql += " order by entity.knowledgeTypeId";
		return this.findByHql(hql);
	}
	
	public void save(KnowledgeType knowledgeType) {
		 super.getHibernateTemplate().save(knowledgeType);
	}
	
	public Long savaKnowNew(KnowFileType knowFileType) {
		return (Long)this.getHibernateTemplate().save(knowFileType);
	}

	public KnowFileType findknowFileType(Long biaoqianid) {
		KnowFileType knowFileType = (KnowFileType)super.getHibernateTemplate().get(KnowFileType.class, biaoqianid);
		return knowFileType;
	}

	
}
